-module(reader).

-export([
    readFile/2
]).

readFile(File, SendTo) ->
    {ok, Device} = file:open(File,[read]),
    read(Device, SendTo).

read(Device, SendTo) ->
    case io:get_line(Device, "") of
        eof  ->
            SendTo ! done,
            file:close(Device);
        Line ->
            SendTo ! {ok,Line},
            read(Device, SendTo)
    end.